lib/commit: Fix object sizes metadata for multiple commits
authorDan Nicholson <nicholson@endlessm.com>
Wed, 23 Oct 2019 15:12:08 +0000 (09:12 -0600)
committerDan Nicholson <nicholson@endlessm.com>
Tue, 21 Jan 2020 03:42:27 +0000 (20:42 -0700)
commit8ec7d6322fe004a93a1b391c279020c5411996c0
tree0d4eea00a62d0766ff6f019d17c03319aba14ac3
parent694b741a366f4abb523f6e4ffbec3f56c5934d1a
lib/commit: Fix object sizes metadata for multiple commits

The object sizes hash table was only being cleared when the repo was
finalized. That means that performing multiple commits while the repo
was open would reuse all the object sizes metadata for each commit.

Clear the hash table when the sizes metadata is setup and when it's
added to a commit. This still does not fix the issue all the way since
it does nothing to prevent the program from constructing multiple
commits simultaneously. To handle that, the object sizes hash table
should be attached to the MutableTree since that has the commit state.
However, the MutableTree is gone when the commit is actually created.
The hash table would have to be transferred to the root file when
writing the MutableTree. That would be an awkward addition to
OstreeRepoFile, though. Add a FIXME to capture that.
src/libostree/ostree-repo-commit.c
src/libostree/ostree-repo-private.h